<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>三级悬浮菜单</title>
    <link rel="stylesheet" href="styles.css">
</head>
<body>
    <nav>
        <ul class="menu">
            <li><a href="#">菜单1</a>
                <ul class="submenu">
                    <li><a href="#">子菜单1-1</a></li>
                    <li><a href="#">子菜单1-2</a>
                        <ul class="subsubmenu">
                            <li><a href="#">子菜单1-2-1</a></li>
                            <li><a href="#">子菜单1-2-2</a></li>
                        </ul>
                    </li>
                </ul>
            </li>
            <li><a href="#">菜单2</a>
                <ul class="submenu">
                    <li><a href="#">子菜单2-1</a></li>
                    <li><a href="#">子菜单2-2</a></li>
                </ul>
            </li>
        </ul>
    </nav>
    <style>
      /* 基础样式 */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f9f9f9;
    margin: 0;
    padding: 20px;
}

nav ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

nav ul li {
    position: relative;
    display: inline-block;
}

nav ul li a {
    display: block;
    padding: 12px 24px;
    text-decoration: none;
    color: #333;
    background-color: #ffffff;
    border-radius: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

nav ul li a:hover {
    background-color: #007bff;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

/* 子菜单样式 */
nav ul li ul {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    padding: 8px 0;
    min-width: 180px;
    z-index: 1000;
}

nav ul li ul li {
    display: block;
}

nav ul li ul li a {
    padding: 10px 20px;
    background-color: transparent;
    box-shadow: none;
    border-radius: 0;
}

nav ul li ul li a:hover {
    background-color: #f0f0f0;
    color: #007bff;
}

/* 三级子菜单样式 */
nav ul li ul li ul {
    top: 0;
    left: 100%;
    margin-left: 8px;
}

/* 显示子菜单 */
nav ul li:hover > ul {
    display: block;
}

/* 菜单项之间的间距 */
nav ul li:not(:last-child) {
    margin-right: 10px;
}
    </style>
</body>
</html>